<script type="text/javascript">
$(document).ready(function(){
	$("#add-friend").click(function(e){
		e.preventDefault();
		//alert('test');
		/*$.post("/User/addFriend/id", { func: "getNameAndTime" },
		  function(data){
		    alert(data.name); // John
		    console.log(data.time); //  2pm
		}, "json");*/
		$(this).text('Sent friend request');
		$(this).attr("disabled", "disabled");

		
	});
});
</script>


<div class="container-fluid">
	<div class="row-fluid">
	    <h1><?php echo $model->username; ?></h1>
		
		<img src="images/avatar/<?php echo $model->id;?>.jpg" width="128" height="128"/>
			
		<p/>
		
		<?php 
			if(isset($isFriend))
			{
				//echo $isFriend;
				if ($isFriend == 1)
				{
					echo "<br>is Friend";
				}
				if ($isFriend == 0)
				{?>
					<br/>
					<button id="add-friend" class="btn btn-primary" href="#">Add Friend</button>					
				<?php 
				} 
			}
		?>
    </div>
	<div class="row-fluid">
	    <div class="span2">
	    	<div class="btn-group">
	          <button data-toggle="dropdown" class="span8 btn btn-primary dropdown-toggle">Action 
	          	<span class="caret pull-right"></span>
	          </button>
	          <ul class="dropdown-menu">
	            <li><a href="#">Action</a></li>
	            <li><a href="#">Another action</a></li>
	            <li><a href="#">Something else here</a></li>
	            <li class="divider"></li>
	            <li><a href="#">Separated link</a></li>
	          </ul>
        	</div>
                                              
			<ul class="nav nav-list">
	          <li class="nav-header">List header</li>
	          <li class="active"><a href="#"><i class="icon-white icon-home"></i> Home</a></li>
	          <li><a href="#"><i class="icon-book"></i> Library</a></li>
	          <li><a href="#"><i class="icon-pencil"></i> Applications</a></li>
	          <li class="nav-header">Another list header</li>
	          <li><a href="#"><i class="icon-user"></i> Profile</a></li>
	          <li><a href="#"><i class="icon-cog"></i> Settings</a></li>
	          <li class="divider"></li>
	          <li><a href="#"><i class="icon-flag"></i> Help</a></li>
	        </ul>
	    </div>
	
	    <div class="span10">
	    <table class="table table-bordered">
	    <tbody>
	    <?php
	    $querystr = 'select * from website ws where ws.id in (
		select DISTINCT wcr.website_id from website_category_rating wcr where wcr.category_id in(
		select us.category_id from user_setting us where us.user_id='.Yii::app()->user->getId()->id.'))'; 
	    $command = Yii::app()->db->createCommand($querystr);
	    $command->execute();
	    $reader=$command->query();
	    $i = 0;
	    foreach($reader as $row)
	    {
	    	
	    	//print_r($row['url']);
	    	if ($i % 2 == 0)
	    	{
	      		echo '<tr>';
	    	}
            echo "<td>".$row['url']."</td>";
           
          	if ($i % 2 == 1)
	    	{
	      		echo '</tr>';
	    	}
	    	$i++;
	    }	    
	    ?>
	        
	    		
	        
	          
	          
	        </tbody>
	    	</table>
	    </div>
    </div>
</div>

<script type="text/javascript">
			$('.dropdown-toggle').dropdown()
		</script>